package de.kardass.jsmatep.in;

import java.util.ArrayList;
import java.util.List;

/**
 * Class representing the import processor's result.
 * 
 * @author Manfred Kardass (manfred@kardass.de)
 *
 */
public class ImportResult<T> {

	private final List<String> importedRecords;
	
	private final List<String> errorRecords;

	private final List<String> skippedRecords;
	
	private final List<T> mappedValueObjects;


	
	ImportResult() {
		this.importedRecords = new ArrayList<String>();
		this.errorRecords = new ArrayList<String>();
		this.skippedRecords = new ArrayList<String>();
		this.mappedValueObjects = new ArrayList<T>();
	}

	public void addImportedRecord(String record) {
		importedRecords.add(record);
	}

	public List<String> getImportedRecords() {
		return importedRecords;
	}

	public int getImportedRecordsCount() {
		return importedRecords.size();
	}

	public void addErrorRecord(String record) {
		errorRecords.add(record);
	}

	public List<String> getErrorRecords() {
		return errorRecords;
	}

	public int getErrorRecordsCount() {
		return errorRecords.size();
	}

	public void addSkippedRecord(String record) {
		skippedRecords.add(record);
	}

	public List<String> getSkippedRecords() {
		return skippedRecords;
	}

	public int getSkippedRecordsCount() {
		return skippedRecords.size();
	}
	
	public List<T> getMappedValueObjects() {
		return mappedValueObjects;
	}

	public int getMappedValueObjectsCount() {
		return mappedValueObjects.size();
	}
	
	public void addMappedValueObject(T valueObject) {
		mappedValueObjects.add(valueObject);
	}

	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("ImportResult [errorRecords=");
		builder.append(errorRecords);
		builder.append(", importedRecords=");
		builder.append(importedRecords);
		builder.append(", skippedRecords=");
		builder.append(skippedRecords);
		builder.append("]");
		return builder.toString();
	}
	
}
